package com.leonardo.tg.example;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;

public class CompromissoListListener implements CommandListener {

	private AgendaMidlet agenda;
	
	public CompromissoListListener(AgendaMidlet agenda) {
		this.agenda = agenda;
	}
	
	public void commandAction(Command c, Displayable d) {
		switch(c.getCommandType()) {
			case Command.OK:
				agenda.add();
				break;
			case Command.CANCEL:
				agenda.delete();
				break;
			case Command.HELP:
				agenda.edit();
				break;
			case Command.EXIT:
				agenda.destroyApp(true);
				break;
		}
	}
}
